import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:smart_translator/app/utils/CommonUtil.dart';

Widget ImageContainer({
  required String name,
  required String? avatarUrl,
  required File? file,
}) {
  double radius = 60.0;
  double radiuspath = 120.0;
  var domainUrl = CommonUtil.getPicPre();
  final concatUrl = '$domainUrl$avatarUrl';
  return Container(
    margin: EdgeInsets.only(top: 100),
    padding: const EdgeInsets.all(5),
    child:
    // Container(child: SvgPicture.asset('assets/images/icon_default_avatar_l.svg'),width: radiuspath,height:radiuspath, ),
    (file !=null &&  file !='')
  ?ClipRRect(borderRadius: BorderRadius.circular(radiuspath),child: Image.file(File(file.path),fit: BoxFit.cover,width: radiuspath,height:radiuspath)):
    (avatarUrl !=''? CircleAvatar(backgroundImage:NetworkImage('$concatUrl'),radius: radius):Container(child: SvgPicture.asset('assets/images/icon_default_avatar_l.svg'),width: radiuspath,height:radiuspath, ))
    // CircleAvatar(backgroundImage: avatarUrl !=''?NetworkImage('$concatUrl'): AssetImage('assets/images/icon_default_avatar_l.png')
    //
    //     ,radius: radius),
  );
}